package org.yoo.study;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class HelloSWT {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell();
		shell.setLayout(null);
		Text hello = new Text(shell, SWT.MULTI);
		shell.setText("Java应用程序");
		shell.setSize(200, 100);
		Color color = new Color(Display.getCurrent(), 255, 255, 255);
		shell.setBackground(color);
		hello.setText("Hello, SWT World!\n\n你好，SWT世界！");
		hello.pack();
		shell.open();
		while (!shell.isDisposed()) { // 如果主窗体没有关闭则一直循环
			if (!display.readAndDispatch()) { // 如果display不忙
				display.sleep(); // 休眠
			}
		}
		display.dispose();
	}

}
